package com.symbio.ishenapi.patient.controller;

import com.symbio.ishenapi.common.controller.BaseController;
import com.symbio.ishenapi.patient.model.TmBackUser;
import com.symbio.ishenapi.patient.model.TmFaqUser;
import com.symbio.ishenapi.patient.model.TmPatientUser;
import io.jboot.Jboot;
import io.jboot.web.controller.annotation.RequestMapping;

import java.util.Date;
import java.util.List;

@RequestMapping("Back")
public class BackController extends BaseController {

    public void feedBack() {  ////帮助与反馈的接口
        TmBackUser tmBackUser = (TmBackUser) getReqBodyObject(TmBackUser.class);

        tmBackUser.setCreateTime(new Date());
        if (tmBackUser.getUserId() == null || "".equals(tmBackUser.getUserId())) {
            renderJsonError(40003, "患者编号");
        } else if (tmBackUser.getFeedBack() == null || "".equals(tmBackUser.getFeedBack())) {
            renderJsonError(40003, "反馈意见");
        } else {
            tmBackUser.save();
            renderJsonError(40001, "反馈意见");
        }
    }


    public void findBack() {  //帮助与反馈的接口
        TmBackUser tmBackUser = (TmBackUser) getReqBodyObject(TmBackUser.class);
        List<TmBackUser> list= TmBackUser.dao.selectBack(tmBackUser);
        renderJsonRet(list);
    }

    public void findFaq(){  //FAQ帮助与反馈带条件
        TmFaqUser tmFaqUser =(TmFaqUser) getReqBodyObject(TmFaqUser.class);
        List<TmFaqUser> list =TmFaqUser.dao.selectFaq(tmFaqUser);
        renderJsonRet(list);
    }

    /*public void patientList(){  //患者列表  （已移到后台）
        TmPatientUser tmPatientUser=(TmPatientUser)getReqBodyObject(TmPatientUser.class);
        List<TmPatientUser> list=TmPatientUser.dao.findPatient();
        renderJsonRet(list);
    }*/
}
